<%- url ||= resource_url_proxy.url_for(action: 'index') -%>

<%= search_form_for @query, url: url, class: 'search_form' do |f| %>
  <div class="search_field">
    <%= render_icon('search') %>
    <%= f.search_field resource_handler.search_field_name,
      class: 'search_input_field',
      placeholder: Alchemy.t(:search) %>
    <% local_assigns.fetch(:additional_query_fields, []).each do |field| %>
      <%= f.hidden_field field %>
    <% end %>
    <%= link_to '', url,
        class: 'search_field_clear',
        id: 'search_field_clear',
        title: Alchemy.t(:click_to_show_all),
        style: params.fetch(:q, {}).fetch(resource_handler.search_field_name, '').present? ? 'display: block' : 'display: none' %>
    <% local_assigns.fetch(:additional_params, []).each do |additional_param| %>
      <%= hidden_field_tag additional_param, params[additional_param] %>
    <% end %>
  </div>
<% end %>
